UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JcL2IkZ5gJGFFm+51C3P7rCPrGVTz/rARDHRZ4rTpN8=' 
WHERE 
  key_id = '3ad6debc5ffbdc2104141722f9bc10857af5c322fc292561a268e49bb79f2d2e' 
  AND (
    token = 'JcL2IkZ5gJGFFm+51C3P7rCPrGVTz/rARDHRZ4rTpN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035