UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cLnH6IKp25lPWWgBQZ12JlZAeKpsV1rm6UPiWlZnI1U=' 
WHERE 
  key_id = 'e05ec33a39386e7409d5f30ae5fd9385e8932fc59990119da0a6ed6cad9273a6' 
  AND (
    token = 'cLnH6IKp25lPWWgBQZ12JlZAeKpsV1rm6UPiWlZnI1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017