UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jz4QkTZfNcRaPN/PLrP+Jejz2TpfAC5o1mUp9m2+MDI=' 
WHERE 
  key_id = '782615714cd663be593d5a06583574d1639dbb715f05cfc0bdf8c06006abad45' 
  AND (
    token = 'Jz4QkTZfNcRaPN/PLrP+Jejz2TpfAC5o1mUp9m2+MDI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032