UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '65lzVhsJwYpCztP+6z0Mzw9piWhRkb0cseor69Qgm9I=' 
WHERE 
  key_id = '1cdabf2eb11e6a0bb891327f53a9418f16e62a479ca1d509fc360417f9307479' 
  AND (
    token = '65lzVhsJwYpCztP+6z0Mzw9piWhRkb0cseor69Qgm9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033