UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eYh9osUgIJ9JhT+dHrdxsNkJioEJ7MlcwpRNivozwdk=' 
WHERE 
  key_id = '7ad9e229ebc870d96d3ceb8bd043df96c8ab5f382d82259baad7914bacb5920a' 
  AND (
    token = 'eYh9osUgIJ9JhT+dHrdxsNkJioEJ7MlcwpRNivozwdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040