UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EES/P+qFLtfFKSwjNNu8Tym5kACBdnDVLctUwbJM6ZI=' 
WHERE 
  key_id = 'cc58e73e98b3efd479ca861ef3bba88f09d3513766d98f55b200d0ad8d434215' 
  AND (
    token = 'EES/P+qFLtfFKSwjNNu8Tym5kACBdnDVLctUwbJM6ZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045