UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r4uNQBqonhAxxnkFLI7mJsFYPdcNi6fFSIQn+QYyF8s=' 
WHERE 
  key_id = 'db1bb29ddd869eb2881054bc78e47a7de8687e28d1b087d0eb0a3612d5bea386' 
  AND (
    token = 'r4uNQBqonhAxxnkFLI7mJsFYPdcNi6fFSIQn+QYyF8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034