UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eKHIINPL3Pmqx+aUjv6xfCeJLw8k9rrf3gakkV32kyI=' 
WHERE 
  key_id = 'd9459d427c1d202feccd2b6fd8f7415f57981dbd3223f3d04e7ff1b952abeac9' 
  AND (
    token = 'eKHIINPL3Pmqx+aUjv6xfCeJLw8k9rrf3gakkV32kyI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022