UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y7u+Hmu0wt+GWK3v+EenXfoqLIxXz1ugYK3lY1zyL3s=' 
WHERE 
  key_id = 'ec521f56d9850ded6542df2d6047b2f6991bb70230537ec984f1ba80c1f33282' 
  AND (
    token = 'y7u+Hmu0wt+GWK3v+EenXfoqLIxXz1ugYK3lY1zyL3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035