UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2S786CVaDOTo2QxNSYWLZvmkZIXn682ue8FDJre4ORI=' 
WHERE 
  key_id = '644de982b0b7acc48789531aa7cb270bdde539a749317dbb2d1c3e046733b808' 
  AND (
    token = '2S786CVaDOTo2QxNSYWLZvmkZIXn682ue8FDJre4ORI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019