UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KR8FLQ2LJbiutsche/5brbK+rixfTvxaQlNPG/th7Us=' 
WHERE 
  key_id = '4503022b22bec39d4d87981ac6c1a202502fb8a50a2e8602195d0e90040a592e' 
  AND (
    token = 'KR8FLQ2LJbiutsche/5brbK+rixfTvxaQlNPG/th7Us=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029