UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '20HussbWQCBuf53NQLCCwMBvPUQElGsJSWePWArg+fs=' 
WHERE 
  key_id = 'c30c3cb798f55ee7d7e05dbb18b00fbab75749daf833bb39ed99a52931144d6e' 
  AND (
    token = '20HussbWQCBuf53NQLCCwMBvPUQElGsJSWePWArg+fs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024