UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z4Q/VD+KK5spOfYtEghCpu/QPC9v3eKLfG+cvEty8qU=' 
WHERE 
  key_id = '1891505c39600c125979471cb5a24a0868b8e9630220f570a2ae192449d0c164' 
  AND (
    token = 'Z4Q/VD+KK5spOfYtEghCpu/QPC9v3eKLfG+cvEty8qU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039