UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+oHC33gJHoJlNBz6yIZ01PCz+PATgcZ1sq3PhtSdzw=' 
WHERE 
  key_id = '5ad145de0856f1e8c6066a5432a9f5d1aab8e540a9b7e01e8f1abd59866d9000' 
  AND (
    token = 'L+oHC33gJHoJlNBz6yIZ01PCz+PATgcZ1sq3PhtSdzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044