UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U9eCLUp0d4H0EYyJ3Qi+jsIjXKiclEGccVfZPtZ8mes=' 
WHERE 
  key_id = '9270dc54e698c6d7931d0716b04697cf417c2f7fec8de21aa73159eaf96e70cc' 
  AND (
    token = 'U9eCLUp0d4H0EYyJ3Qi+jsIjXKiclEGccVfZPtZ8mes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018