UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1N5UwMWct8mMRw3waEGnp4E2uEDlTLN51w99aeW/N44=' 
WHERE 
  key_id = '37bf889789a4abb82b237e90400a7b5add616fb0df227fa1dfb18e0c18cffc76' 
  AND (
    token = '1N5UwMWct8mMRw3waEGnp4E2uEDlTLN51w99aeW/N44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044