UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gKjjkFh94xjCLgIdg7EkXgfvKyIX/X5H46OdWpt38P4=' 
WHERE 
  key_id = '13adf09ffcfa1af4e8b7335804e73794bee505a7288e36986a2ef13d21a98651' 
  AND (
    token = 'gKjjkFh94xjCLgIdg7EkXgfvKyIX/X5H46OdWpt38P4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024