UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PeLxWgQQPuozcjfSyogOImKoU8UXnNce5x8yhQV9bm8=' 
WHERE 
  key_id = '20ce945a259e010c76453262499b498fb0776f91b5cb019e9cd5ffdd49a4b0e4' 
  AND (
    token = 'PeLxWgQQPuozcjfSyogOImKoU8UXnNce5x8yhQV9bm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041