UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UoyjvZBKvQ9tppwJ5uhqUlZhItD6BGKpBj5RCV3iY0s=' 
WHERE 
  key_id = '5a386b939121193ad9fb7c073493d1cab73342df86bd11a2e71c5840228ed991' 
  AND (
    token = 'UoyjvZBKvQ9tppwJ5uhqUlZhItD6BGKpBj5RCV3iY0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034