UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZPedCl24j2PqUkPl/8B54oX2MJfN1MXv2Tc3Oj8K+To=' 
WHERE 
  key_id = '13864d7703c0db793b57dc6dcf32332490ea2e9785b87cee270732d1f85335cf' 
  AND (
    token = 'ZPedCl24j2PqUkPl/8B54oX2MJfN1MXv2Tc3Oj8K+To=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028