UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h7glXhhRgt7f0K0+2ABusfL62QGh2+VFOrHZ/2Uq/Z4=' 
WHERE 
  key_id = '5665bb47d39db007631b93d20625bd22cb9af5bacebef592853351ce79812236' 
  AND (
    token = 'h7glXhhRgt7f0K0+2ABusfL62QGh2+VFOrHZ/2Uq/Z4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021