UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JAPvOwBGo0cRCbzuz3sX/GIISXgJghvYmqaJDg0nOho=' 
WHERE 
  key_id = '812053041956a76bb0811aad106d7369574276c5366e9d581c2903b3f8eb10d0' 
  AND (
    token = 'JAPvOwBGo0cRCbzuz3sX/GIISXgJghvYmqaJDg0nOho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032