UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PLvZTVU6E11iXCpKEp3lCI2k/pvnDAqAZTjSPMTSXXs=' 
WHERE 
  key_id = '9dcb256639b55bc8555635717fc65c4d271389e49b02506d3435c1130693b334' 
  AND (
    token = 'PLvZTVU6E11iXCpKEp3lCI2k/pvnDAqAZTjSPMTSXXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023