UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+ZSu9oya+zx1VzFWEcPSv5MS7ILEj+PzxENbktNxO5M=' 
WHERE 
  key_id = '0c6ccfc1f0d870877c6d0c5279fb99b10c5b215a7ba8362414690adc9793d521' 
  AND (
    token = '+ZSu9oya+zx1VzFWEcPSv5MS7ILEj+PzxENbktNxO5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023