UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j3HGIsqmK3gX47bFIGITqVsopzlAu9Jmoo5BQZwKn+g=' 
WHERE 
  key_id = '220e4eab33a20245dc5b8b9b590ae2305d1d56420e009f581cd8a8693ea75060' 
  AND (
    token = 'j3HGIsqmK3gX47bFIGITqVsopzlAu9Jmoo5BQZwKn+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046