UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ys9whqYVN1+Ek2dmAX71ljQZMHeG7al8jZA+07wJdGs=' 
WHERE 
  key_id = 'cdb5eb0ff5bcdfe008dde16eb6eef1547d98742b2ccc2dae596637ed784ae7f0' 
  AND (
    token = 'Ys9whqYVN1+Ek2dmAX71ljQZMHeG7al8jZA+07wJdGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032