UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HEPh63+xMceMIZlDkH3NI6ccLuEPA3mnqvz4prmxeGY=' 
WHERE 
  key_id = 'd403dcf2fbeaab4dd12fe7150064224abc6fc2915c8c088cb590fe85efc8fb57' 
  AND (
    token = 'HEPh63+xMceMIZlDkH3NI6ccLuEPA3mnqvz4prmxeGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022