UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UzErcn+Q8YyT7zeq+Po1DtW2U8MHvZ9qaX6JBRk6xo4=' 
WHERE 
  key_id = '817d4d8f8ba8d82b5f1c1378f933762f2f476e93dd9c3dbf32ab8cabce8a0030' 
  AND (
    token = 'UzErcn+Q8YyT7zeq+Po1DtW2U8MHvZ9qaX6JBRk6xo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019