UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RgvqaqFluhZFwktklDOR9Xv2MIkw3Pp/4A8aFhm67qU=' 
WHERE 
  key_id = '5f2d7912f8988f79df7f8f11632220b7ba131530ce9586bca179c5158743e5d5' 
  AND (
    token = 'RgvqaqFluhZFwktklDOR9Xv2MIkw3Pp/4A8aFhm67qU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028