UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y4K3JIjMLS86ljIVLmGS0BU4TYKPFirARBKVdZM+6EY=' 
WHERE 
  key_id = 'f656324a5c11919351caf80604a05f904b97c828265f77ac0b877e61a122762e' 
  AND (
    token = 'y4K3JIjMLS86ljIVLmGS0BU4TYKPFirARBKVdZM+6EY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027