UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dM8XGTptdhquqHGaG59laEVChxKQH/0ohAdzLnsOt6c=' 
WHERE 
  key_id = 'e6658f16e86d6bcaf64ff76b87d8a0e0919f31e2d0eba6d1a7c35018c05b2dc0' 
  AND (
    token = 'dM8XGTptdhquqHGaG59laEVChxKQH/0ohAdzLnsOt6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043