UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vuYo1lz+VUwAqCXCKDWPLz40DWV48sLNA5A2rm54Myk=' 
WHERE 
  key_id = '54589ca7e578f75e17afcc78f9d22c4e4d6abdadc9055318d9a21f585992780b' 
  AND (
    token = 'vuYo1lz+VUwAqCXCKDWPLz40DWV48sLNA5A2rm54Myk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015