UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UODfatrhgZ3TxJHvw7t5Jy0qtQbrHM6yYEIfQqzE3GU=' 
WHERE 
  key_id = '30299b45a5d182ea2723117e89bdad03ff54d6bd47340037de2861efcdbfe992' 
  AND (
    token = 'UODfatrhgZ3TxJHvw7t5Jy0qtQbrHM6yYEIfQqzE3GU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049