UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xg+hGE4Y0djQLJCartATbrjc5JiM0s3xgtXZQdMXKT8=' 
WHERE 
  key_id = '8b319b2c347a230f8156daf102c6545208db35da990d3dadf9062fb33b820447' 
  AND (
    token = 'xg+hGE4Y0djQLJCartATbrjc5JiM0s3xgtXZQdMXKT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030